home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18168 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.0 KB  |  84 lines

  1. Path: wintermute.ecs.fullerton.edu!titan!grosin
  2. From: grosin@titan (Gil Rosin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Linking C++ with ASM Class members -- HOW??
  5. Date: 19 Apr 1996 01:14:07 GMT
  6. Organization: California State University at Fullerton
  7. Message-ID: <4l6pcv$q4r@wintermute.ecs.fullerton.edu>
  8. NNTP-Posting-Host: titan.ecs.fullerton.edu
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. Hi, I am writing a program in C++ using Borland C++ v3.1.
  12.  
  13. First of all, let me start the question off right, lets say I have a program
  14. that is a general user utility. It is a graphical program where I do my own
  15. low level graphics. What is common/good practice to handle graphics primitives?
  16.  
  17. 1) Make a "graphics" class with all the low level graphics primatives and in
  18. each "drawItem()" function, declare an instance of the "graphics" class and
  19. draw the items using the members through the graphics class.
  20.  
  21. OR
  22.  
  23. 2) Make graphics primatives members of all "Item" classes.
  24.  
  25. OR
  26.  
  27. 3) Don't make graphics primatives members of any class and just leave them
  28. globally accessible.
  29.  
  30. Before you make your descision, let me clarify what I'm doing :). I have a
  31. "kit" that gives several controls. Each control has a member function that
  32. draws it on the screen. The member function that draws it on the screen in
  33. turn has to call low level graphics functions that I have written in
  34. assembler such as DrawCircle(), DrawLine(), DrawPixel() etc, etc.
  35.  
  36. Now, what is the common way to handle the primatives from the above 3 choices?
  37. I personally think #1. It has the class protection, but doesn't take up as
  38. much memory as the other 2. #2 is a memory hog, to have instances of every
  39. graphics primative in every instance of a control class? Didn't seem good
  40. to me. #3 seems just as good as #1, but doesn't have class protection.
  41.  
  42. Is there a way to make a graphics class that is only accessible from the
  43. control class, but not a new instance?
  44.  
  45. Also, the following question is aimed more towards people who know how to do
  46. this with borland C++.
  47.  
  48. If I have the following class:
  49.  
  50. class Test
  51.  {
  52.   public:
  53.     void Func(int, int, char);
  54.  };
  55.  
  56. If void Func is implemented in ASM, I HAVE to call this function:
  57.  
  58. proc @Test@Func$qiinc far
  59.  
  60. endp
  61.  
  62. The $qiinc is I have discovered the parameter list of the function. This is
  63. apperently how borland C++ calls ALL functions in C++. 
  64.  
  65. I don't really have the complete manual set any more, but from what I do have
  66. I couldnt find anything on how to get this parameter list. Can some one post
  67. a table maybe?
  68.  
  69. The way I am doing it now is having a test program that calls a function
  70. with the same exact parameters, getting assembly output and seeing what the
  71. parameter list is in the ASM output.
  72.  
  73. It would be much easier if I had a table. I have unlocked the mystery of a few
  74. types, but it gets a bit nasty with a lot of non numeric types and pointers,
  75. if not, (I don't really expect a BC++ user to read this, what are the chances
  76. of that? <g>) I can just use the ASM output.
  77.  
  78. Anyways, any info/input on any of this email, please reply via
  79. email to grosin@titan.fullerton.edu.
  80.  
  81. Thanks.
  82.  
  83.  
  84.